package com.film.admincontroller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.film.domain.Film;
import com.film.service.FilmService;
import com.film.service.impl.FilmServiceImpl;
@WebServlet("/updateFilm.do")
public class UpdateFilmController extends HttpServlet{
	private FilmService  filmService = new FilmServiceImpl();
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String exceptFilm = request.getParameter("exceptFilm");
		String filmId = request.getParameter("filmId");//电影id
		String filmName= request.getParameter("filmName");//电影名
		String filmForeignName= request.getParameter("filmForeignName");//电影英文名
		String filmPlace= request.getParameter("filmPlace");//电影产地
		String filmIunguage= request.getParameter("filmIunguage");//电影语言
		String filmShowTime= request.getParameter("filmShowTime");//电影上映时间
		String filmTime= request.getParameter("filmTime");//电影片长
		String filmIntroduce= request.getParameter("filmIntroduce");//电影描述
		System.out.println(filmId+"-->"+filmName+"-->"+filmForeignName+"-->"+filmPlace+"-->"+filmIunguage+"-->"+filmShowTime+"-->"+filmTime+"-->"+filmIntroduce);
		Film film = new Film(Integer.parseInt(filmId),filmName,filmForeignName,filmPlace,filmTime,filmShowTime,filmIunguage,filmIntroduce);
		int result = filmService.updateFilmInfo(film);
		if(result == 1 && "0".equals(exceptFilm)) {
			response.sendRedirect("/film/adminHotFilm.do");
		}else if(result == 1 && "1".equals(exceptFilm)){
			response.sendRedirect("/film/showFilmExhibition.do");
		}
	}
}
